/*
* @Author: Marte
* @Date:   2017-05-01 14:46:11
* @Last Modified by:   Marte
* @Last Modified time: 2017-05-17 11:01:00
*/

// 基于准备好的dom，初始化echarts实例
{
var myChart = echarts.init(document.getElementById('chart'));

// 指定图表的配置项和数据

var option = {
    title: {
        text: '实时大盘3502.9万',
        x: 'center',
        textStyle: {
            color: '#fff',
            fontWeight: 'normal',
            fontSize: 12
        }
    },
    backgroundColor:'#172750',
    textStyle: {
        color: '#fff'
    },
    tooltip : {
        trigger: 'axis',
        axisPointer: {
            type: 'cross',
            label: {
                backgroundColor: '#6a7985'
            }
        }
    },
    legend: {
        data:['销量']
    },
    toolbox: {
        feature: {
            saveAsImage: {
                title: '下载'
            }
        }
    },
    xAxis: {
        boundaryGap : false,
        axisLine: {
            lineStyle: {
                color: '#fff'
            }
        },
        data: ["04-01","04-06","04-11","04-16","04-21","04-25"]///----------------------------------X轴数据
    },
    yAxis: {
        name: '万',
        axisLine: {
            lineStyle: {
                color: '#fff'
            }
        },
        splitLine: 'false',
        splitNumber: 2
    },
    series: [{
        name: '票房',
        type: 'line',
        lineStyle: {
            normal: {
                color: '#fff',
                width: 1
            }
        },
        itemStyle: {
            normal: {
                color: '#fff'
            }
        },
        areaStyle: {
            normal: {
                color: {
                    type: 'linear',
                    x: 0,
                    y: 0,
                    x2: 0,
                    y2: 1,
                    colorStops: [{
                        offset: 0, color: '#d8b9ff' // 0% 处的颜色
                    }, {
                        offset: 1, color: '#7a69fe' // 100% 处的颜色
                    }],
                    globalCoord: false // 缺省为 false
                }
            }
        },
        data: [5, 20, 36, 10, 10, 20]///----------------------------------Y轴数据
    }]
};

// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
}






{
var oNum = document.getElementById('num');
var aDiv = oNum.getElementsByTagName('div');
var aImg = oNum.getElementsByTagName('img');
var P = 148056;
var piaofangStr = ''+P;

function getPiaofang(){
    for(var i=0; i<piaofangStr.length; i++){
        move(aImg[i],{
            top:-piaofangStr.charAt(i)*(aDiv[0].offsetHeight-4)
        },{
            duration:1000
        })
    }
};
getPiaofang();
setInterval(function(){
    getPiaofang();
    P+=parseInt(Math.random()*2, 10);
    piaofangStr = ''+P;
    console.log(piaofangStr);
},2750);
}

{
    var oGetTime = document.getElementById('getTime');
    function clock(){
        var oDate = new Date();
        // document.write(oDate);
        var Y = oDate.getFullYear();
        var M = oDate.getMonth()+1;
        var D = oDate.getDate();
        var h = oDate.getHours();
        var m = oDate.getMinutes();
        var s = oDate.getSeconds();
        var week = oDate.getDay();
        if(h<10){
            h = "0"+h;
        }
        if(m<10){
            m = "0"+m;
        }
        if(s<10){
            s = "0"+s;
        }
        var str = Y+'年'+M+'月'+D+'日'+' '+h+':'+m+':'+s;

        //星期六
        oGetTime.innerHTML = str;
    }
    clock();
    setInterval(clock,1000);
}





